package com.yanqu.road.server.cmd.activity.carptrip;

import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.CarpTripProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.carptrip.CarpTripActivity;
import com.yanqu.road.server.manager.activity.carptrip.CrossCarpTripActivityMgr;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CARP_TRIP_PVP_FIGHT, desc = "PVP")
public class CrossCarpTripPVPFightCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CarpTripProto.CrossCarpTripPVPFightReqMsg reqMsg = CarpTripProto.CrossCarpTripPVPFightReqMsg.parseFrom(packet.getBytes());
        CarpTripActivity activity = CrossCarpTripActivityMgr.getCarpTripActivity(reqMsg.getActivityId());
        if(activity != null){
            activity.fight(serverId, packet.getPlayerId(), reqMsg.getCellId(), reqMsg.getTargetId(), reqMsg.getMyAbility(), PlayerBasePb.parseToUserBaseInfo(reqMsg.getBaseInfo()));
        }
    }

    @Override
    public void sendData() {

    }
}
